﻿var my3dChart = null;
var seriesWord3d = null;
var option3d = null;
var g_isShowChina = false;
define(function (require) {
    var ecConfig = require('echarts/config');
    var ec = require('echarts');
    require('echarts-x');
    require('echarts/chart/map');
    require('echarts/chart/bar');
    require('echarts/chart/scatter');
    require('echarts-x/chart/map3d');

    my3dChart = ec.init(document.getElementById('container2'));

    seriesWord3d = {
        name: 'Globe',
        type: 'map3d',
        mapType: 'world',

        //background: 'images/s3-3-1/starfield.jpg',
        // Have a try to change an environment
        // background: 'asset/background.jpg',

        baseLayer: {
            backgroundColor: '',
            backgroundImage: 'images/s3-3-1/earth.jpg',
            quality: 'medium'
        },
        mapLocation: {
            width: '117%'
        },
        light: {
            show: false,
            // Use the system time
            // time: '2013-08-07 18:09:09',
            sunIntensity: 2
        },
        data: [{
            name: 'China'
        }],
        roam: {
            autoRotate: true,
            minZoom: 2,
            maxZoon: 2,
            preserve: false
        },
        itemStyle: {
            normal: {
                label: {
                    show: true
                },
                borderWidth: 1,
                borderColor: 'yellow',
                areaStyle: {
                    color: 'rgba(0, 0, 0, 0)'
                }
            }, emphasis: {
                label: {
                    show: true
                },
                borderWidth: 1,
                borderColor: 'red',
                areaStyle: {
                    color: '#0009ff'
                }
            }
        }
    };

    option3d = {
        series: [seriesWord3d]
    };

    my3dChart.setOption(option3d);

    my3dChart.on(ecConfig.EVENT.CLICK, function (param) {
        if (param.name === 'China') {
            eventShowChina();
        }
    });
});